package com.bbkb.common.page;

import lombok.Data;

import java.io.Serializable;
import java.util.Collections;
import java.util.List;

@Data
public class PageResult<T> implements Serializable {

    private static final long serialVersionUID = -8799172233610574935L;

    private int pageNum;

    private int pageSize;

    private List<T> list;

    private long total;


    public PageResult() {

    }

    public PageResult(List<T> list) {
        if (list == null) {
            list = Collections.emptyList();
        }
        this.pageNum = 1;
        this.pageSize = list.size();
        this.list = list;
        this.total = list.size();
    }

    public PageResult(int pageNum, int pageSize, long total) {
        this.pageNum = pageNum;
        this.pageSize = pageSize;
        this.total = total;
    }

}
